package com.example.arouter

import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback

/**
 * 局部导航回调
 * */
class LocalNavigationCallBack constructor(private val path : String=""): NavigationCallback {

    private var defaultPath : String ="/empty/activity"

    /**
     * 匹配到目标页面
     * */
    override fun onFound(postcard: Postcard) {

    }

    /**
     * 表匹配到目标页面
     * */

    override fun onLost(postcard: Postcard) {
        if (!path.isNullOrEmpty()){
            defaultPath=path as String
        }
        postcard.path=defaultPath
        postcard.navigation()
    }
    /**
     * 已经跳转到目标页面
     * */
    override fun onArrival(postcard: Postcard) {
        //可以做一些统计的功能

    }
    /**
     * 跳转拦截
     * */
    override fun onInterrupt(postcard: Postcard) {
        //处理拦截业务
    }
}